In a storage system, data reliability is usually ensured by using an erasure code (EC) coding technology. In the EC coding technology, a redundancy bit is added by encoding to-be-stored data. When a storage device becomes faulty, the redundancy bit is used to recover data in the faulty device. A redundant array of independent disks (RAID) is also referred to as a redundant array of inexpensive disks (RAID), and is referred to as a disk array for short. A principle of RAID is combining a plurality of relatively inexpensive hard disks into a hard disk array group, to make performance equivalent to or even better than that of an expensive huge-capacity hard disk. The RAID improves data security by using a design of scattered data arrangement. With development of RAID technologies, the EC coding technology is applied to the RAID technology, to continuously improve data security. For example, RAID 5, RAID 6, RAID 7, and the like are all RAID technologies implemented based on the EC coding technology.
In a storage system implemented based on a RAID technology, a plurality of data blocks together with parity data form a stripe in a RAID, and be separately written into a plurality of magnetic disks forming the RAID. Using the RAID technology, data can be stored into and read from the plurality of magnetic disks simultaneously, so that a data throughput of the storage system can be greatly increased. In addition, the RAID technology provides a fault tolerance function that is based on data check. When a fault of a magnetic disk causes an error or a loss to a data block in a stripe, data in the faulty magnetic disk can be recovered based on other data blocks and parity data in the stripe.
However, in the storage system using the RAID technology, if a fraction of data in a stripe needs to be updated, data in the stripe corresponding to a current update location needs to be read into a memory, and then this fraction of data is updated. After the update, parity data is recalculated, and then updated data and the recalculated parity data are written back into a magnetic disk. In this updating method, an amount of data that is actually written is greater than an amount of data that needs to be written, causing write amplification (WA) of the system and making update performance of the system relatively poor.